package cn.edu.scau.cmi.yangzemin.ComprehensiveExperiment;
import cn.edu.scau.cmi.yangzemin.client.AbstractFactoryClient;
import cn.edu.scau.cmi.yangzemin.client.AdapterClient;
import cn.edu.scau.cmi.yangzemin.client.ConsistentCompositeClient;
import cn.edu.scau.cmi.yangzemin.client.FactoryClient;
import cn.edu.scau.cmi.yangzemin.client.InterProgrammingClient;
import cn.edu.scau.cmi.yangzemin.client.MultitonClient;
import cn.edu.scau.cmi.yangzemin.client.SimpleFactoryMethodClient;
import cn.edu.scau.cmi.yangzemin.client.SingletonClient;
import cn.edu.scau.cmi.yangzemin.comprehension.client.HibernateClient;
import cn.edu.scau.cmi.yangzemin.spring.client.SpringApplicationContextClient;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
public class ComprehensiveExperimentUIController {
	@FXML	private Button singleton;
	@FXML	private Button factory;
	@FXML	private Button multipleModel;
	@FXML	private Button IOCDISpring;
	@FXML	private Button objectAdapter;
	@FXML	private Button safeComposite;
	@FXML	private Button ORMHibernate;
	@FXML	private Button interfacePeogramming;
	@FXML	private Button consistentComposite;
	@FXML	private Button simpleFactoryMethod;
	@FXML	private Button abstractFactory;
	@FXML	private Button classAdapter;
	@FXML	private ImageView imagePhoto;
	
	public void init() {
		singleton.setOnAction(this::slton);
		factory.setOnAction(this::fac);
		multipleModel.setOnAction(this::mulModel);
		IOCDISpring.setOnAction(this::iocSpring);
		objectAdapter.setOnAction(this::objAdapter);
		safeComposite.setOnAction(this::safeCom);
		ORMHibernate.setOnAction(this::orm);
		interfacePeogramming.setOnAction(this::interfacePro);
		consistentComposite.setOnAction(this::consistentComp);
		simpleFactoryMethod.setOnAction(this::spleFacMethod);
		abstractFactory.setOnAction(this::absFactory);
		classAdapter.setOnAction(this::claAdapter);
	}

	void slton(ActionEvent event){
		SingletonClient singletonClient = new SingletonClient();
		try {singletonClient.start(new Stage());}
		catch (Exception e1){e1.printStackTrace();}
	}
	void fac(ActionEvent event) {
		FactoryClient fac = new FactoryClient();
		fac.main(null);
	}
	void mulModel(ActionEvent event) {
		MultitonClient multitonClient= new MultitonClient();
		try {multitonClient.start(new Stage());}
		catch (Exception e1){e1.printStackTrace();}
	}
	void iocSpring(ActionEvent event) {
		 HibernateClient  hibernateClient =new  HibernateClient ();
		 try {hibernateClient.start(new Stage()); }
		 catch (Exception e1){e1.printStackTrace();}
	}
	void objAdapter(ActionEvent event) {
		AdapterClient adapterClient=new AdapterClient();
		try {adapterClient.start(new Stage());}
		catch (Exception e1){e1.printStackTrace();}	
	}
	void safeCom(ActionEvent event) {
		ConsistentCompositeClient consistentCompositeClient =new ConsistentCompositeClient();
		consistentCompositeClient.main(null);
	}
	void orm(ActionEvent event) {
		 HibernateClient  hibernateClient =new  HibernateClient ();
		 try {hibernateClient.start(new Stage()); }
		 catch (Exception e1){e1.printStackTrace();} 
	}
	void interfacePro(ActionEvent event) {
		InterProgrammingClient interProgrammingClient=new InterProgrammingClient();
		interProgrammingClient.main(null);
	}
	void consistentComp(ActionEvent event) {
		ConsistentCompositeClient consistentCompositeClient =new ConsistentCompositeClient();
		consistentCompositeClient.main(null);	
	}
	void spleFacMethod(ActionEvent event){
		SimpleFactoryMethodClient  simpleFactoryMethodClient = new SimpleFactoryMethodClient();
		simpleFactoryMethodClient.main(null);
	}
	void absFactory(ActionEvent event) {
		AbstractFactoryClient abstractFactoryClient=new AbstractFactoryClient();
		abstractFactoryClient.main(null);
	}
	void claAdapter(ActionEvent event) {
		AdapterClient adapterClient=new AdapterClient();
		try {adapterClient.start(new Stage());}
		catch (Exception e1){e1.printStackTrace();}
	}
}
